<#assign module="company"/>

<@override name="header">
<link rel="stylesheet" href="${ctx}/assets/css/datepicker/datepicker.css">
<link rel="stylesheet" href="${ctx}/assets/css/datetimepicker.css">
</@override>
<@override name="body">

<div class="tabbable tabs-left">
	<div class="row">
		<@shiro.isMainCompany>
			<@shiro.hasPermission name='companyadd'>
				<div class="col-xs-12 col-md-2" style="float:right;padding: 0px 20px 15px 5px;">
					<button class="pull-right buttoncss" onclick="window.location='${ctx}/company/add';"><b>+</b>&nbsp;添加子公司</button>
				</div>
			</@shiro.hasPermission>
		</@shiro.isMainCompany>
		<div class="col-xs-1">
		</div>
	</div>
</div>


<div class="tab-content">
	<div class="container-fluid ">
  		<div class="row query-pad">
			<div class="col-xs-11" style="padding: 0px 0px 15px 5px;">
		  		<div class="form-group input-query">
		  			<span style="width:350px;"><input id="name" type="text" class="form-control" name="name" value="" placeholder="输入公司名称、拼音首字母、简称"></span>
		  		</div>
		  	</div>
		  	<div class="col-xs-1"style="padding: 0px 0px 15px 15px;">
				<div class="input-query-bttom">
    				<button id="searchButton" type="button">查询</button>
    			</div>
			</div>
  		</div>
  	</div>
</div>
	
<div class="tabta-content">  	
	<table class="table table-condensed table-striped">
		<tbody>
			<tr>
				<th>操作</th>
				<th>公司名称</th>
				<th>公司简称</th>
				<@daijia>
				<th>代驾收费</th>
				</@daijia>
				<th>联系电话</th>
				<th>负责人</th>
				<th>手机号码</th>
				<th>公司地址</th>
				<th>创建时间</th>
				<th>操作</th>
			</tr>
		</tbody>
	</table>
	<div style="text-align:center;" id="NoData"></div>
	</br>
	<ul class="pagination pull-left pagination-sm pageshow" id="pageshow" style="display:none;">
		<li><a></a></li>
	</ul>
	<ul class="pagination pull-left pagination-sm pagedata" id="pagedata" style="display:none;">
    </ul>
</div>


</@override>
<@override name="footer">
	<script type="text/javascript">
		window.daijia = {
			ctx:'${ctx}',
			userId:'<@shiro.principal property='id'/>'
		};
		var dj = false;
		<@daijia>
			dj=true;
		</@daijia>
	</script>
	<script src="${ctx}/assets/js/pushmessage.js"></script>
	<script type="text/javascript">
		var thisButton;
		function deleteCompany(){
			$.ajax({
				  type: 'POST',
				  url: ctx+'/company/delete/'+thisButton.attr("data-value"),
				  async: false,
				  dataType: "json",
				  success: function(data){
					  if(data.success){
						  thisButton.parent().parent().remove();
						  $.scojs_message('删除成功', $.scojs_message.TYPE_OK);
					  }
					  else{
						  $.scojs_message(data.message, $.scojs_message.TYPE_ERROR);
					  }
				  }
			});
		}
		
		$(document).ready(function(){
		    $(".deletethis").click(function(){
				thisButton = $(this);
				var confirm = $.scojs_confirm({
		            content: "删除该公司将删除该公司下所有服务人员和服务人员相关联的数据， 确定要删除吗？",
		            action:deleteCompany
		        });
		        confirm.show();
			});
		});
	</script>
	<script src="${ctx}/assets/js/jquery.paging.min.js"></script>
	<script src="${ctx}/assets/js/datepicker.js"></script>
	<script src="${ctx}/assets/js/company/list.js"></script>
</@override>
<@extends name="../layout.ftl"/>
